package com.prime.tutorial.moviestore.dao;


import com.prime.tutorial.moviestore.domain.*;
import org.springframework.stereotype.Repository;

import javax.persistence.Query;
import java.util.List;

@Repository
public class UserActivityDAOWithJPA extends GenericDAOWithJPA<UserActivity, Long> implements UserActivityDAO {


     public List<UserActivity> findByUser(Users users) {
        Query query = entityManager.createQuery("Select distinct ua from UserActivity ua inner join ua.user as u where ua.user = ?1");
        query.setParameter(1, users.getId());
        return query.getResultList();
    }

}